<template>
    <div class="tableWrapper">
        <div class="card">
            <div class="item"><a href="javascript:void(0)" @click="toSkip('/sjwh/zczy')">中压台账<br />数据维护</a></div>
            <div class="item"><a href="javascript:void(0)" @click="toSkip('/sjwh/yxzy')">中压停电<br />数据维护</a></div>
            <div class="item"><a href="javascript:void(0)" @click="toSkip('')">中压不停电<br />事件维护</a></div>
            <div class="item"><a href="javascript:void(0)" @click="toSkip('/sjwh/zcgy')">高压台账<br />数据维护</a></div>
            <div class="item"><a href="javascript:void(0)" @click="toSkip('/sjwh/yxgy')">高压停电<br />数据维护</a></div>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
    data() {
      return {
        dwbm: '',
        dwjb: '',
        dwmc: '',
        dwxz: '',
        dwxzm: ''
      }
    },
    props: {
        propData: {
            type: Object,
            default: function() {
                return {};
            }
        }
    },
    computed: {
        ...mapGetters(['czdwinfo'])
    },
    watch: {
        propData: {
            deep: true,
            handler(newVal, oldVal) {
                this.dwbm = newVal.dwbm
                this.dwjb = newVal.dwjb
                this.dwmc = newVal.dwmc
                this.dwxz = newVal.dwxz
                this.dwxzm = newVal.dwxzm
            }
        }
    },
    mounted() {
        const that = this
        let czdwinfo = null
        if (typeof that.czdwinfo == 'string') {
            czdwinfo = JSON.parse(that.czdwinfo)
        } else {
            czdwinfo = that.czdwinfo
        }
        that.dwjb = czdwinfo.dwjb
    },
    methods: {
        toSkip(path) {
            const that = this
            if (!that.dwbm) {
                that.$message.warning('请选择单位编码！')
                return false
            }
            let dwjb = parseInt(that.dwjb, 10)
            if (dwjb < 4) {
                that.$message.warning('地市级供电公司及以上单位不能维护数据！')
                return false
            }
            // if (!that.dwxzm) {
            //     that.$message.warning('所选单位无单位性质码，请先维护此信息！')
            //     return false
            // }
            let obj = {
                dwbm: that.dwbm,
                dwjb: that.dwjb,
                dwmc: that.dwmc,
                dwxz: that.dwxz,
                dwxzm: that.dwxzm
            }
            sessionStorage.setItem("treeNode", JSON.stringify(obj))
            that.$router.push(path)
        }
    }
}
</script>
<style lang="scss" scoped>
.tableWrapper {
  height: 100%;
  text-align: center;
}
.card {
    display: inline-block;
    padding-top: 100px;
}
.card .item {
    width: 120px;
    height: 90px;
    float: left;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    padding: 0 20px 0 0;
}
.card .item a {
    border-radius: 10px;
    display: block;
    width: 100px;
    line-height: 25px;
    padding: 20px 0;
    box-shadow: 4px 4px 1px #9dc8f4;
    text-decoration: none;
    color: #409eff;
    background: #ecf5ff;
}
.card .item a:hover {
    background-color: #409eff;
    color: #fff;
}
</style>
